package com.ebt.m.customer.entity;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Rick.Wang on 2016/12/8.
 */
public class CustomerDetail implements Serializable, Cloneable {

    private String customerId;
    private String name;
    private String namePrefix;
    private Integer sex;
    private Integer age;
    private Long birthday;
    private Integer marriage;
    private Integer educationGrading;
    private String portraitPath;
    private Integer careerCategory;
    private Integer tag;
    private Integer isConfirm;
    private String importContact;
    private String level;
    private Integer relationFlag;
    private List<CustomerContact> listCustomerContact;
    private List<CustomerAddress> listCustomerAddress;
    private String bloodType;
    private Integer changeStatus;
    private String customerErpId;
    private Integer customerStatus;
    private Integer height;
    private String idCard;
    private Integer identity;
    private Integer isDemo;
    private Integer isRegular;
    private Long lastActiveTime2;
    private String customerIdentity;


    public String getBloodType() {
        return bloodType;
    }

    public void setBloodType(String bloodType) {
        this.bloodType = bloodType;
    }

    public Integer getChangeStatus() {
        return changeStatus;
    }

    public void setChangeStatus(Integer changeStatus) {
        this.changeStatus = changeStatus;
    }

    public String getCustomerErpId() {
        return customerErpId;
    }

    public void setCustomerErpId(String customerErpId) {
        this.customerErpId = customerErpId;
    }

    public Integer getCustomerStatus() {
        return customerStatus;
    }

    public void setCustomerStatus(Integer customerStatus) {
        this.customerStatus = customerStatus;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public Integer getIdentity() {
        return identity;
    }

    public void setIdentity(Integer identity) {
        this.identity = identity;
    }

    public Integer getIsDemo() {
        return isDemo;
    }

    public void setIsDemo(Integer isDemo) {
        this.isDemo = isDemo;
    }

    public Integer getIsRegular() {
        return isRegular;
    }

    public void setIsRegular(Integer isRegular) {
        this.isRegular = isRegular;
    }

    public Long getLastActiveTime2() {
        return lastActiveTime2;
    }

    public void setLastActiveTime2(Long lastActiveTime2) {
        this.lastActiveTime2 = lastActiveTime2;
    }


    public String getCustomerIdentity() {
        return customerIdentity;
    }

    public void setCustomerIdentity(String customerIdentity) {
        this.customerIdentity = customerIdentity;
    }


    public String getImportContact() {
        return importContact;
    }

    public void setImportContact(String importContact) {
        this.importContact = importContact;
    }

    public Integer getRelationFlag() {
        return relationFlag;
    }

    public void setRelationFlag(Integer relationFlag) {
        this.relationFlag = relationFlag;
    }


    public String getContactPhone() {
        if (listCustomerContact == null || listCustomerContact.size() == 0) {
            return null;
        }
        for (CustomerContact cs : listCustomerContact) {
            if (cs != null && cs.ctype == 1) {
                return cs.cvalue;
            }
        }
        return null;
    }

    /**
     * 深度复制
     *
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    public Object clone() throws CloneNotSupportedException {
        CustomerDetail c = (CustomerDetail) super.clone();
        if (listCustomerContact != null) {
            List<CustomerContact> list = new ArrayList<>();
            list.addAll(listCustomerContact);
            c.setListCustomerContact(list);
        }
        if (listCustomerAddress != null) {
            List<CustomerAddress> list = new ArrayList<>();
            list.addAll(listCustomerAddress);
            c.setListCustomerAddress(list);
        }
        return c;
    }

    @Override
    public String toString() {
        return "[ customerId : " + customerId
                + " name : " + name
                + " sex : " + sex
                + " age : " + age
                + " birthday : " + new SimpleDateFormat("yyyy-MM-dd").format(birthday)
                + " marriage : " + marriage
                + " educationGrading : " + educationGrading
                + " portraitPath : " + portraitPath
                + " careerCategory : " + careerCategory
                + " tag : " + tag
                + " isConfirm : " + isConfirm + " ]";
    }

    //getter setter 方法
    public String getNamePrefix() {
        return namePrefix;
    }

    public void setNamePrefix(String namePrefix) {
        this.namePrefix = namePrefix;
    }

    public List<CustomerContact> getListCustomerContact() {
        return listCustomerContact;
    }

    public void setListCustomerContact(List<CustomerContact> listCustomerContact) {
        this.listCustomerContact = listCustomerContact;
    }

    public List<CustomerAddress> getListCustomerAddress() {
        return listCustomerAddress;
    }

    public void setListCustomerAddress(List<CustomerAddress> listCustomerAddress) {
        this.listCustomerAddress = listCustomerAddress;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getIsConfirm() {
        return isConfirm;
    }

    public void setIsConfirm(Integer isConfirm) {
        this.isConfirm = isConfirm;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public Integer getTag() {
        return tag;
    }

    public void setTag(Integer tag) {
        this.tag = tag;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getCareerCategory() {
        return careerCategory;
    }

    public void setCareerCategory(Integer careerCategory) {
        this.careerCategory = careerCategory;
    }

    public Long getBirthday() {
        return birthday;
    }

    public void setBirthday(Long birthday) {
        this.birthday = birthday;
    }

    public Integer getMarriage() {
        return marriage;
    }

    public void setMarriage(Integer marriage) {
        this.marriage = marriage;
    }

    public Integer getEducationGrading() {
        return educationGrading;
    }

    public void setEducationGrading(Integer educationGrading) {
        this.educationGrading = educationGrading;
    }

    public String getPortraitPath() {
        return portraitPath;
    }

    public void setPortraitPath(String portraitPath) {
        this.portraitPath = portraitPath;
    }

}